package com.cheng.example.atguigu.design_pattern.facade;

/*
 * @author 程帅
 * @createTime: 2020/10/21 21:46
 * @Created: with IntelliJ IDEA.
 */

//家庭影院门面
public class HomTheaterFacade {

    //定义各个子系统对象
    private Popcorn popcorn;
    private DVDPlay dvdPlay;
    private Projector projector;
    private Screen screen;
    private Stereo stereo;
    private TheaterLight theaterLight;

    public HomTheaterFacade() {
        super();
        this.popcorn = Popcorn.getInstance();
        this.dvdPlay = DVDPlay.getInstance();
        this.projector = Projector.getInstance();
        this.screen = Screen.getInstance();
        this.stereo = Stereo.getInstance();
        this.theaterLight = TheaterLight.getInstance();
    }

    // 操作分成4步

    //准备方法
    public void ready() {
        popcorn.on();//打开爆米花机
        popcorn.pop(); //生产爆米花
        screen.down();//放下屏幕
        projector.on();//打开投影仪
        stereo.on();//打开音响
        dvdPlay.on();//打开dvd
        theaterLight.dim();//调淡灯光
    }

    public void play() {
        dvdPlay.play();//播放dvd
    }

    public void pause() {
        dvdPlay.pause();//暂停dvd
    }

    public void end() {
        popcorn.off();//关闭爆米花机
        theaterLight.bright();//灯光调亮
        screen.up();//屏幕升起
        projector.off();//关闭投影仪
        stereo.off();//关闭音响
        dvdPlay.off();//关闭dvd
    }

}
